package reflect;

import java.lang.reflect.Method;

public class ReflectDemo10 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        //判断Person类中的sayHello方法是否被注解@AutoRunMethod标注
        Class cls = Class.forName("reflect.Person");
        Method method = cls.getDeclaredMethod("sleep");
        boolean mark = method.isAnnotationPresent(AutoRunMethod.class);
        if(mark){
            System.out.println(method.getName()+"()被标注了!");
        }else{
            System.out.println(method.getName()+"()没有被标注!");
        }
    }
}
